<template>
  <div class="home">
    <button @click="fun">跳转到about</button>
    <div>
      <My-child :title="title" v-on:back="funBack"></My-child>
      接收子元素的传参{{ text }}
    </div>
    <div>
      <p>兄弟元素1
        <Bro-one></Bro-one>
      </p>
      <p>兄弟元素2
        <Bro-two></Bro-two>
      </p>
    </div>
  </div>
</template>

<script>
// @ is an alias to /src
import MyChild from "@/components/MyChild.vue";
import BroOne from "@/components/BroOne.vue"
import BroTwo from "@/components/BroTwo.vue"

export default {
  name: "HomeView",
  data() {
    return {
      num: 10,
      title: 11,
      text: "",
    };
  },
  components: {
    MyChild,
    BroOne,
    BroTwo
  },
  methods: {
    fun() {
      this.$router.push({
        path: "/about",
        query: {
          num: this.num,
        },
      });
    },
    funBack(val) {
      this.text = val;
    },
  },
  created(){

      console.log(this.$children,'children')
   
    
  }
};
</script>
